<?php
namespace app\index\controller;

use think\Controller;
use think\facade\Env;
use think\facade\Config;
use think\facade\Session;
use app\index\model\User as UserModel;

class Base extends Controller
{
    protected $current_user;

    protected $app_lang;

    protected $app_env;

    protected $static_version;

    protected function initialize()
    {
        $this->current_user = UserModel::currentUser();
        $this->assign('current_user', $this->current_user);

        $this->app_lang = Config::get('app.default_lang');
        $this->assign('app_lang', $this->app_lang);

        $this->app_env = Config::get('app.env');
        $this->assign('app_env', $this->app_env);

        if($this->app_env == 'production'){
            $this->static_version = Env::get('app.static_version');
        }else{
            $this->static_version = time();
        }
        $this->assign('static_version', $this->static_version);
    }
}
